<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/common/header.jsp"%>
<%@taglib prefix="code" tagdir="/WEB-INF/tags"%>

<div style="margin:20px 0;"></div>
<div class="easyui-panel">
	<div style="padding:10px 60px 20px 60px">
	<form id="historyAppForm"  name="historyAppForm" method="post" action="<c:url value='/history/saveHistoryAppDetail.do'/>" enctype="multipart/form-data">
	<input type="hidden" id="ins_app_history_uuid" name="ins_app_history_uuid" value="${infEntity.ins_app_history_uuid}"/>
	<input type="hidden" readonly="readonly" id="ins_app_uuid"  name="ins_app_uuid" value="${infEntity.ins_app_uuid}"></input>
	<input type="hidden" id="ins_uuid" name="ins_uuid" value="${infEntity.ins_uuid}"/>
	<input type="hidden" id="rec_id" name="rec_id" value="${infEntity.rec_id}"/>
			<table cellpadding="5" style="width:100%">
				<tr>
					<td>所属机构:</td>
					<td>
						<input class="easyui-textbox" type="text"  data-options="required:true" readonly="readonly" id="inst_name" value="${infEntity.inst_name}"/>
						<a href="javascript:void(0)" class="easyui-linkbutton detail-remove" iconCls="icon-search" id="selelctBtn">选择</a>
					</td>
					<td>APP名称:</td>
					<td><input class="easyui-textbox" type="text" readonly="readonly" id="app_name_app"  name="app_name_app" value="${infEntity.app_name_app}"></input></td>
					<%--<input type="hidden" id="ins_app_uuid" name="ins_app_uuid" value="${infEntity.ins_app_uuid}"/>--%>
					<%--<input  type="hidden" readonly="readonly" id="ins_app_uuid"  name="ins_app_uuid" value="${infEntity.ins_app_uuid}"></input>--%>
				</tr>
				<tr>
					<td>APP类型:</td>
					<td><code:codeSelect id="app_type" name="app_type"  code_type="APP_TYPE" selectId="${infEntity.app_type}"></code:codeSelect></td>
					<td>版本号:</td>
					<td><input class="easyui-textbox" type="text"  name="app_version" data-options="required:true,validType:['length[0,120]']" value="${infEntity.app_version}"></input></td>
				</tr>
				<tr>
					<td>安卓包VersionCode:</td>
					<td><input class="easyui-textbox" type="text" name="android_version_code" data-options="required:true,validType:['length[0,120]']"  value="${infEntity.android_version_code}"/></td>
					<td>安卓包大小(字节):</td>
					<td><input class="easyui-textbox" type="text" name="android_apk_size" data-options="required:true,validType:['number']"  value="${infEntity.android_apk_size}"/></td>
				</tr>
				<tr>
					<td>安卓包MD5:</td>
					<td><input class="easyui-textbox" type="text" name="android_update_md5" data-options="required:true,validType:['length[0,120]']"  value="${infEntity.android_update_md5}"/></td>
					<td>APK文件:</td>
					<td><input class="easyui-filebox" name="apkFile" data-options="buttonText:'选择文件',prompt:'选择一个.apk文件'" style="width:50%"/></td>
				</tr>
				<tr>
					<td>更新说明:</td>
					<td><input class="easyui-textbox" type="text" name="app_desc" style="height:200px;width:400px" data-options="required:true,multiline:true" value="${infEntity.app_desc}"/></td>
				</tr>
			</table>
	<div style="text-align:center;padding:5px">
		<a href="javascript:void(0)" class="easyui-linkbutton btn detail-remove" iconCls="icon-save" onclick="submitForm('historyAppForm')">保存</a>
		<a href="javascript:void(0)" class="easyui-linkbutton btn" iconCls="icon-back" onclick="back()">返回</a>
	</div>
</form>
	</div>
</div>

<div id="menuTree">
	<div id="ztreeObj" class="ztree"></div>
</div>
<script>

   /* $(function(){
        $("#app_type").combobox({
            onSelect: function(record){
                alert(record);
            }
        });
	});*/

   var ztreeObj;
   /*选择按钮*/
   $("#selelctBtn").click(function(){
       ztreeObj = showAppTree(selected, $("#ins_uuid").val());
   });

   /*确定按钮回调*/
   function selected(){
       var nodes = ztreeObj.getSelectedNodes();
       console.log(nodes);
       if(nodes && nodes.length > 0){
           $("#app_name_app").textbox("setValue", nodes[0].APPNAME);
           $("#inst_name").textbox("setValue", nodes[0].NAME);
           $("#ins_app_uuid").val(nodes[0].INSUUID);
           $("#ins_uuid").val(nodes[0].ID);
       }
   }
   function showAppTree(confirmCallback, uuid, option){
       var options = {
           url: "../organization/getAppInfTree.do",
           title: "选择机构",
           confirmCallback: confirmCallback,
           openIds: uuid,
           showSearch: true,
           searchTitle: "机构代码/名称"
       };
       options = $.extend({}, options, option);
       return showTree(options);
   }
   function showTree(options){
       var jpTree = $().jpTree(options);
       return jpTree;
   }
</script>